//
//  j3FilePath.cpp
//  HJC3D
//
//  Created by HJC on 11-10-10.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#include "j3FilePath.h"
#import <UIKit/UIKit.h>


std::string j3ResourcePath(const std::string& fileName)
{
    NSString* name = [NSString stringWithCString:fileName.c_str() encoding:NSUTF8StringEncoding];
    NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:name];
    return std::string([path UTF8String]);
}



std::string j3ResourceContent(const std::string& fileName)
{
    NSString* name = [NSString stringWithCString:fileName.c_str() encoding:NSUTF8StringEncoding];
    NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:name];
    NSString* string = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
    return std::string([string UTF8String]);
}